package com.m4bce.json_rest;

import org.json.JSONArray;
import org.json.JSONObject;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;

import android.content.Context;

public class JsonRestService {
	
	private static JsonRestService instance;
	
	public static JsonRestService getService(Context context){
		if(instance == null){
			instance = new JsonRestService(context);
		}
		return instance;
	}
	
	private Context context;
	private RequestQueue queue;
	
	private JsonRestService(Context context){
		this.context = context;
		queue = Volley.newRequestQueue(context);
	}
	
	public void delete(String url, JSONObject object){
		
		JSONObject jsonRequest = new JSONObject();
		JsonObjectRequest request = new JsonObjectRequest(Request.Method.DELETE, url, jsonRequest, listener, errorListener);
		queue.add(request);
	}
	
	public void delete(String url, JSONArray array){
		
	}
	
	public void insert(String url, JSONObject object){
		
	}
	
	public void insert(String url, JSONArray array){
		
	}

}
